package com.chenyongjing.design.pattern.strategy.pay.payport;

/**
 * 模板模式
 * @Author chen
 * @Date 2022/11/13 16:15
 */
public abstract class Payment {

    public abstract String getName();

    public MsgResult pay(String uid,double amount){
        if(queryBalance(uid)<amount){
            return new MsgResult(500,"支付失败","余额不足");
        }
        return new MsgResult(200,"支付成功","支付金额"+amount);
    }

    /**
     * 账户金额
     * @param uid
     * @return
     */
    protected abstract  double queryBalance(String uid);

}
